<?php

namespace Api\Member\AccessLog\Manager;

use Illuminate\Http\Request;
use Laravel\Lumen\Routing\Controller as BaseController;
use Carbon\Carbon;

/**
 * 控制器
 */
class Controller extends BaseController
{
    /**
     * 构造方法
     */
    public function __construct(
        AccessLogRepository $AccessLogRepository
    ) {
    	$this->AccessLogRepository = $AccessLogRepository;
    }

    /**
     * 站外发送
     * 
     * @param \Illuminate\Http\Request $request
     */
    public function getToday(Request $request)
    {
        try {
            $log = $this->AccessLogRepository->getForDate(Carbon::today());
            return $log ? $log->total : 0;
            success();
        } catch (\Member\AccessLog\Exceptions\Exception $e) {
            error('validation_fail', $e->getMessage());
        }
    }


}